{% extends 'base.html' %}

{% block table %}
<li class="nav-item">
    <a class="nav-link" href="{{ url_for('new') }}">发布文章</a>
</li>
<li class="nav-item">
    <a class="nav-link" href="{{url_for('about')}}">关于测试</a>
</li>
{% endblock %}

{% block content %}
<h1>{% block title %} 测试使用页面 {% endblock %}</h1>

{% for post in posts %}
<div>
    <div>
        <a href="{{url_for('post', post_id=post['id'])}}">
            <h2>{{ post['title'] }}</h2>
        </a>
    </div>
    <div>
        <div style="float: left">
            <span class="bg bg-primary">{{ post['created']}}</span>
        </div>
        <div>
            <form style="float: right" action="{{ url_for('delete', post_id=post['id']) }}" method="post">
                <input type="submit" value="删除" class="btn btn-danger btn-sm"
                       onclick="return confirm('确定要删除吗?')">
            </form>
            <form style="float: right" action="{{ url_for('edit', post_id=post['id']) }}" method="get">
                <input type="submit" value="编辑" class="btn btn-warning btn-sm">
            </form>
        </div>
    </div>
    <br>
    <hr>
</div>

{% endfor %}

{% endblock %}